<?php 

// Include the configuration file for error management and such.
require_once ('./includes/config.inc.php'); 

// Set the page title and include the HTML header.
$page_title = 'Newnham College Associates: Logout';
$site_section = 'Logout';
include ('./includes/header.html');

if (!isset($_SESSION['user_level'])) {

   user_redirect('/login.php');
   exit(); // Quit the script.
}  else { // Logout the user.

  $_SESSION = array(); // Destroy the variables.
  session_destroy(); // Destroy the session itself.
  setcookie (session_name(), '', time()-300, '/', '', 0); // Destroy the cookie.
}

?>
<h1>Logout</h1>
<p>You have been logged out.</p>

<?php // Include the HTML footer file.
include ('./includes/footer.html');
?>